/**
 *  @file HttpParams.h
 */
#ifndef _HTTPPARAMS_H_
#define _HTTPPARAMS_H_

#include "../../common/BaseObject.h"
#include "../../lang/Primitive.h"
#include "../../collections/HashtableT.h"
#include "HttpConst.h"

namespace cppflib
{

class CFString;

namespace net
{

namespace http
{

/**
 *  A class to gather all the HTTP parameters
 */
class _DLLAPI HttpParams : public BaseObject
{
public:
    typedef enum
    {
       P_NONE = 0,
       P_CONNTIMEOUT = 1,    // int
       P_SOTIMEOUT,          // int 
       P_SOCKETFACTORY,      // SocketFactory
       P_USERAGENT,          // CFString
       P_SERVER,             // CFString
       P_ISSERVER,           // bool
       P_PROXY,              // NameValuePair 
                             // (for HttpClient, name is proxy domain/IP, value is port number) 

       P_ENDPOINTSOCKET,     // Socket (used by HttpServer)
       
    } param_t;

private:
    collections::HashtableT<lang::Int32, BaseObject> *pParamTbl;

public:
    HttpParams(void);
    virtual ~HttpParams(void);

    /* Get methods */
    bool Exists(param_t p) const;
    const BaseObject * GetParam(param_t p) const;
    int GetIntParam(param_t p) const;
    bool GetBooleanParam(param_t p) const;
    const CFString * GetStrParam(param_t p) const;

    /* Set methods */
    void SetParam(param_t p, BaseObject * pVal);
    void SetParam(param_t p, int val);
    void SetParam(param_t p, bool val);
    void SetParam(param_t p, pcwstr_t pStr);

    /* Remove param */
    void RemoveParam(param_t p);
};

} // end of namespace http

} // end of namespace net

} // end of namespace cppflib


#endif
